/*
Copyright (c) 2019 Alibaba Group Holding Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
//*******************************
//         ASCON_AEAD_EN 
//*******************************
#ifndef __ASCON_AEAD_EN_H_
#define __ASCON_AEAD_EN_H_

#include "my_sys.h"

#define ASCON_AEAD_EN_RX_BASE   0xf0200000
#define ASCON_AEAD_EN_REG_BASE  0xf0200400
#define ASCON_AEAD_EN_TX_BASE   0xf0200800
#define ASCON_AEAD_EN_REG       ((Ascon_Aead_En_TypeDef *) ASCON_AEAD_EN_REG_BASE)

typedef struct
{
 u32 MBN;//msg_block_num
 u32 MA; //msg_addr
 u32 ACS;//aead_ctrl_sta
 u32 ACE;//aead_ctrl_en
 u32 ACM;//aead_ctrl_mode
 u32 AHA;//aead_h_addr
 u32 AAL;//附加信息
 u32 AAH;//附加信息
 u32 AK0;//秘钥 
 u32 AK1;//秘钥
 u32 AK2;//秘钥
 u32 AK3;//秘钥  
 u32 AN0;//随机数 
 u32 AN1;//随机数
 u32 AN2;//随机数
 u32 AN3;//随机数
 u32 AT0;//提取的摘要信息 只读 
 u32 AT1;//提取的摘要信息 只读
 u32 AT2;//提取的摘要信息 只读
 u32 AT3;//提取的摘要信息 只读   
}Ascon_Aead_En_TypeDef;

typedef struct
{
 u32 msg_block_num;//msg_block_num 待提取摘要的数据数量,单位byte
 u32 msg_addr;//msg_addr 待提取摘要信息存储在rx buf的地址
 u32 aead_ctrl_mode;//aead_ctrl_mode 摘要引擎的工作模式
 u32 aead_c_addr;//aead_h_addr 生成的摘要存放在tx buf的地址
 u32 aead_a[2];//附加信息  小端模式
 u32 aead_k[4];//秘钥  小端模式
 u32 aead_n[4];//随机数 小端模式
 u32 aead_t[4];//提取的摘要信息 只读 小端模式
 u32* msg_data;  //待提取摘要的数据指针
 u32* aead_data; //生成的摘要指针
 FunctionalState aead_ctrl_en;//aead_ctrl_en 使能提取摘要算法
}Ascon_Aead_En_InitTypeDef;

extern void Ascon_Aead_En_Init(Ascon_Aead_En_InitTypeDef* ascon_aead_initstruct);
extern void Ascon_Aead_En_Send_Msg(Ascon_Aead_En_InitTypeDef* ascon_aead_initstruct);
extern void Start_Ascon_Aead_En(Ascon_Aead_En_InitTypeDef* ascon_aead_initstruct);
extern u8 Whether_Ascon_En_Aead(void);
void Get_Ascon_Aead_En_Tag(Ascon_Aead_En_InitTypeDef* ascon_aead_initstruct);
extern void Get_Ascon_Aead_En_Ct(Ascon_Aead_En_InitTypeDef* ascon_aead_initstruct);

#endif